FF6 Battle Background Palettes Helper
-------------------------------------
by madsiur
version 1.02
released on 07/29/2017
to be used with a FF3us 1.0 or 1.1 headerless ROM


Summary
-------
In one sentence, what this archive contain ease the battle background (BBG) palette editing
by allowing correct background images to be edited in Gimp, then their palettes imported 
in the ROM.

If you have no background custom palette, what is important to you to edit in gimp and import 
in the ROM are the background images in the "backgrounds 8bpp indexed" folder and the 
palette importer (#3 below) in the "palette importer" folder. All the rest can be ignored.


#1 Palette Exporter
-------------------
Located in the "palette exporter" folder. This utility simply convert all backgrounds palettes 
into Microsoft RIFF palette format that you can import in Gimp. This is however not what you 
will manually do. Those palette files are later neccesary for the image converter to work. 
To export all the palettes, simply place a headerless FF3us ROM in the same folder as the exporter
and double click on the exporter executable. A folder with your ROM name will be created with
all the palettes files inside.

#2 Image Converter
------------------
Located in the "image converter" folder. In order for the background image to have the same 
palette order than the ROM, we need to convert existing BBGs rips from non-8bpp-indexed PNG format 
to 8bpp indexed 256 format with correct palette order. To do this you need at least one BBG rip 
named "BG_XX.png" where XX is the BBG FF3us ID in hexadecimal. The second thing need is the BBG 
palette file named "BG_XX_PAL_YY.bin". YY is the FF3us BBG palette index. This correct filename 
is generated when exporting palettes (see #1) and palette ID for the BBG is fetched from BBG data. 
You need one palette file and one BBG PNG rip matching for a single succesfull conversion. 
You therefore can have the 54 palettes files and 54 BBG rips in the same folder as the converter and
launch all images conversions at once by clicking on the converter. 

I have include 256x147 rips in the "backgrounds 32bpp" folder. The sub-folder "alternate" contain
moving background you could replace and rename in "main" sub-folder, which are static and static 
versions of all backgrounds. For each matching palette file and BBG rip, the converter will 
create an indexed BBG image with correct palette order in "final" subfolder. This folder is 
created if it doesn't exist. 

You will get no error with what is included in the archive. However the interesting part would be 
if you have a custom BBG palette already to first export the palette. Secondly, you would need 
the same colors as the palette on your BBG rip so you can do this with a manual palette import 
in gimp. Any way to import a palette in Gimp will result in incorrect palette order. 
This is where the converter would be handy. In the occurence a BBG rip color is not found in 
the FF3us palette, the converter will throw an error and no image will be generated in 
the "final" folder.

Images in the "final" folder are ready to be edited with gimp. This is not a gimp tutorial so
the only thing I'll say is you must not optimize or change the palette order in gimp. Doing so
will result in incorrect BBG colors once the palette is imported in the ROM. Once your colors edit
done in gimp, export you palette in txt format. Your palette file should have the same format as
the gimp_palette_sample.txt provided in this archive.

Note: Images generated with the archive rips and palettes would be the same as the ones in the 
"backgrounds 8bpp indexed" folder. The work is already done!

#3 Palette Importer
-------------------
Put you exported Gimp .txt palette file(s) in the "palette importer folder". You palette file must 
be named "BG_XX.txt" where XX is the FF3us ID of the BBG you just edited in gimp. You also need 
your ROM in the same folder as the importer. Click on the importer and it will fetch the correct 
palette ID for the BBG(s) and import the palette file(s) in the ROM. Quick and simple!


Other Info
----------
FF6hacking Forums Thread:
https://www.ff6hacking.com/forums/thread-3508.html

Battle Backgrounds on the ff6hacking wiki:
https://www.ff6hacking.com/wiki/doku.php?id=sprite:bgs

RHDN Entry:
http://www.romhacking.net/utilities/1321/

Github repository:
https://github.com/madsiur/FF6-BBG-Helper/

contact: themadsiur@gmail.com
